/**
 *    @file       srvdef.h
 *
 *    @brief      
 *    @details
 *
 *    @version    1.0
 *    @date       02/10/2014 05:45:09 PM
 *
 *    @author     Theophilus (), wangtf418@gmail.com
 */
#ifndef _SF_SRVDEF_H_
#define _SF_SRVDEF_H_
#include "comdef.h"

//define macro for task
#define DEFAULT_TASKID 0

//define macro for thread
#define MAX_THREAD_TYPE 64
#define RAND_THD_INDEX BF_UINT32_MAX

//workthread type : [0-9] is defined by srvframe, [10-63] is for user
#define THD_TYPE_MAIN 0
#define THD_TYPE_TIMER 1
#define THD_TYPE_MAINTAIN 2
#define THD_TYPE_ONTIME 3
#define THD_TYPE_LISTEN 4
#define THD_TYPE_PROCESS 5
#define THD_TYPE_SERVER 6
#define THD_TYPE_CLIENT 7
#define THD_TYPE_DB 8
#define THD_TYPE_FILE 9

//sockettask type : [0-12] is defined by srvframe, [13-] is for user
#define TSK_TYPE_MAINTAIN_UDP 0
#define TSK_TYPE_MAINTAIN_TCP 1
#define TSK_TYPE_MAINTAIN_HTTP 2

#define TSK_TYPE_TCP_LISTEN 3
#define TSK_TYPE_TCP_SERVER 4
#define TSK_TYPE_TCP_CLIENT 5

#define TSK_TYPE_UDP_SERVER 6
#define TSK_TYPE_UDP_CLIENT 7

#define TSK_TYPE_HTTP_SERVER 8
#define TSK_TYPE_HTTPCLIENT 9

#define TSK_TYPE_LONGTCP_LISTEN 10
#define TSK_TYPE_LONGTCP_SERVER 11
#define TSK_TYPE_LONGTCP_CLIENT 12

//define message type
#define MSG_TYPE_ADD_ITIMER 0
#define MSG_TYPE_ADD_PTIMER 1
#define MSG_TYPE_ITIMER_ONTIME 2
#define MSG_TYPE_PTIMER_ONTIME 3
#define MSG_TYPE_RECV 4
#define MSG_TYPE_PROC 5
#define MSG_TYPE_SEND 6
#define MSG_TYPE_SENDREQ 7
#define MSG_TYPE_RECVRES 8
#define MSG_TYPE_PROC_HEAD 9
#define MSG_TYPE_PROC_GET 10
#define MSG_TYPE_PROC_POST 11

//define recv and send buf len
#define TCP_RECV_BUF_LEN 4096
#define UDP_RECV_BUF_LEN 4096
#define TCP_SEND_LEN_MAX 204800
#define HTTP_HEAD_LEN 4096
#define HTTP_BODY_LEN 102400

//define maintain command type
#define MAINTAIN_CMD_TYPE_LOGSWITCH 1
#define MAINTAIN_CMD_TYPE_LOGSWITCH_RES 2

#endif

